<?php
	/**
 	 * Help articles helper
 	 * 
 	 * @package Helpers
	 * @author Anton Perkin
	 * @version 1.0
 	 */
	class HelpHelper extends HtmlHelper
	{
	    /**
		 * Generates help articles table
		 *
		 * @param array $help_articles help articles
		 */			
		public function HelpTable(array $help_articles)
		{
			//table of contents
			echo "<table class='tableOfContents'>";
			echo "<tr><td class='tableOfContents_header'>".ucfirst(LANG_TABLE_OF_CONTENTS).":</td></tr>";
			echo "<tr><td>";
			echo "<ul class='tableOfContents'>";
			foreach ($help_articles[articles] as $article)
			{
				echo "<li class='tableOfContents'>";
				$this->link("#{$article[title]}", $article[title]);
				echo "</li>";
				echo "<br />";
			}
			echo "</ul></td></tr>";
			
			//guide table
			echo"
				<table class='help'>";

			foreach ($help_articles[articles] as $article)
			{
				echo "	
					<tr class='helpHeader'>
						<td colspan='3' class='helpHeader'><a name='{$article[title]}' style = 'font-size: 12px;'>{$article[title]}</a>";
						$this->link('#top', " <img src='".IMAGES."arrow_up.gif' />");
						echo "</td>
					<tr>
					<tr class=''>
						<td colspan='3' class='helpDescription'>{$article[description]}</td>
					<tr>";
			
				foreach ($article[items] as $item)
				{
					echo "<tr><td colspan='3' class='helpTitle'>{$item[title]}</td></tr>";
					echo "<tr><td width='15'>&nbsp;</td><td colspan='2' class='helpItem'>{$item[text]}</td></tr>";
				}
				echo "<tr><td>&nbsp;</td></tr>";
			}
			echo "</table>";			
		}
	}
?>